Skip to content

Conversation

@abhayguptas
Copy link
Contributor

@abhayguptas abhayguptas commented Apr 27, 2025

Fixes #1424

This PR improves the README examples by wrapping the setProviderAndWait method inside a try-catch block.
Since setProviderAndWait can throw an exception if the provider initialization fails, it's important to handle it safely to prevent unexpected crashes during runtime.

Changes made:

  • Updated the main usage example to wrap setProviderAndWait with a try-catch.
  • Updated the synchronous usage section with a try-catch block and explanatory comment.

Why?

  • Improves the reliability and production-readiness of the documentation examples.
  • Helps users adopt better error handling practices from the start.

Checklist:

  • Added try-catch around setProviderAndWait
  • Updated both main and synchronous usage sections
  • Ensured formatting matches the current README style

Signed-off-by: Abhay <abhayakg123@gmail.com.com>
@abhayguptas abhayguptas requested review from a team as code owners April 27, 2025 10:46
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@sonarqubecloud
Copy link

Copy link
Member

@aepfli aepfli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This excellent addition helps us normalize our documentation throughout our SDK landscape.

PS: I fixed the checkstyle issues, so we can go ahead with merging, as soon as we have all the approvals

@codecov
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.25%. Comparing base (99faaf8) to head (bc96bfe).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1433      +/-   ##
============================================
+ Coverage     92.81%   93.25%   +0.44%     
- Complexity      469      471       +2     
============================================
  Files            43       43              
  Lines          1127     1127              
  Branches         91       91              
============================================
+ Hits           1046     1051       +5     
+ Misses           53       48       -5     
  Partials         28       28              
Flag Coverage Δ
unittests 93.25% <ø> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aepfli aepfli merged commit 96cf9c7 into open-feature:main Apr 28, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] Clarify the behavior of setProviderAndWait

4 participants